package com.carbeauty.common.enums;

/**
 * 支付方式枚举
 * 
 * @author CarBeauty Team
 */
public enum PaymentMethod {
    
    /**
     * 现金支付
     */
    CASH("CASH", "现金", "现金支付"),
    
    /**
     * 银行卡支付
     */
    BANK_CARD("BANK_CARD", "银行卡", "银行卡刷卡支付"),
    
    /**
     * 微信支付
     */
    WECHAT("WECHAT", "微信支付", "微信扫码支付"),
    
    /**
     * 支付宝支付
     */
    ALIPAY("ALIPAY", "支付宝", "支付宝扫码支付"),
    
    /**
     * 余额支付
     */
    BALANCE("BALANCE", "余额支付", "使用账户余额支付"),
    
    /**
     * 积分支付
     */
    POINTS("POINTS", "积分支付", "使用积分抵扣支付"),
    
    /**
     * 组合支付
     */
    MIXED("MIXED", "组合支付", "多种支付方式组合");
    
    private final String code;
    private final String name;
    private final String description;
    
    PaymentMethod(String code, String name, String description) {
        this.code = code;
        this.name = name;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getName() {
        return name;
    }
    
    public String getDescription() {
        return description;
    }
    
    public static PaymentMethod fromCode(String code) {
        for (PaymentMethod method : values()) {
            if (method.code.equals(code)) {
                return method;
            }
        }
        throw new IllegalArgumentException("未知的支付方式代码: " + code);
    }
}
